package com.xc.erp.modules.erp.controller.origanization;

import com.xc.erp.modules.erp.domain.AjaxResult;
import com.xc.erp.modules.erp.domain.TreeSelect;
import com.xc.erp.modules.erp.service.JshOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/origanization")
public class OriganizationController {

    @Autowired
    private JshOrganizationService jshOrganizationService;

    @GetMapping("/tree")
    public AjaxResult tree(){
        List<TreeSelect> treeSelects = jshOrganizationService.buildTreeSelect();
        if (treeSelects != null) {
            return AjaxResult.success(treeSelects);
        }
        return AjaxResult.error("没有数据");
    }
}
